﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using tinyweb.framework;
using Bepo.Ext;

namespace Bepo.Helpers
{
    public class JsworkerHandler
    {
        public static byte[] text = null;
        public IResult Get()
        {
            if (text == null)
            {
                // Read js file
                var filePath = HttpContext.Current.Server.MapPath("~/Content/worker.js");
                text = File.ReadAllBytes(filePath);
            }

            HttpContext.Current.Response.BinaryWrite(text);
            HttpContext.Current.Response.CacheHard();
            return Result.None();
        }
    }
}